#pragma once
#include "InputKey.h"

class InputListener
{
public:
	InputListener(void);
	virtual ~InputListener(void);
	virtual bool onKeyDown(InputKey key){return false;};
	virtual bool onKeyUp(InputKey key){return false;};
	virtual bool onMouseDown(int x,int y,MouseButton mb,Dword flags){return false;};
	virtual bool onMouseUp(int x,int y,MouseButton mb,Dword flags){return false;};
	virtual bool onMouseMove(int x,int y,int deltaX,int deltaY,Dword flags){return false;};
	virtual bool onMouseWheel(int x, int y, int zDelta, Dword flags){return false;};
};

class InputListenerChain : public InputListener
{
public:
	virtual bool onKeyDown(InputKey key);
	virtual bool onKeyUp(InputKey key);
	virtual bool onMouseDown(int x,int y,MouseButton mb,Dword flags);
	virtual bool onMouseUp(int x,int y,MouseButton mb,Dword flags);
	virtual bool onMouseMove(int x,int y,int deltaX,int deltaY,Dword flags);
	virtual bool onMouseWheel(int x, int y, int zDelta, Dword flags);
public:
	void push(InputListener* listener);
	void clear();
private:
	typedef std::list<InputListener*> ListenerChain;
	ListenerChain chain;
};